/*     */ package com.qmsk.business.store.salebill.dao;
/*     */ 
/*     */ import com.qmsk.business.member.shopMember.dao.ShopMemberDAO;
/*     */ import com.qmsk.business.sys.basic.SupportDAO;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import java.sql.SQLException;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class SaleBillDao extends SupportDAO
/*     */ {
/*     */   public GsonEbRst getGsonOfId(Long id)
/*     */     throws SQLException
/*     */   {
/*  16 */     Map params = new HashMap();
/*  17 */     params.put("id", id);
/*  18 */     return getGsonOfParams("selectSqlOfShopId", params, false);
/*     */   }
/*     */ 
/*     */   public GsonHeadOneRow getGsonOneRowOfId(Long id) throws SQLException {
/*  22 */     Map params = new HashMap();
/*  23 */     params.put("id", id);
/*  24 */     return getOneRowOfParams("selectSqlOfShopId", params);
/*     */   }
/*     */ 
/*     */   public GsonEbRst getGsonOfShopId(Map<String, Object> params, Integer nPageIdx, Short nPageSize) throws SQLException
/*     */   {
/*  29 */     return getGsonOfParams("selectSqlOfShopId", params, nPageIdx, 
/*  30 */       nPageSize, true);
/*     */   }
/*     */ 
/*     */   public GsonEbRst getGsonOfShopIdSum(Map<String, Object> params) throws SQLException
/*     */   {
/*  35 */     return getGsonOfParams("getGsonOfShopIdSum", params, false);
/*     */   }
/*     */ 
/*     */   public GsonEbRst getGsonOfShopIdAndRtime(Map<String, Object> params, Integer nPageIdx, Short nPageSize) throws SQLException
/*     */   {
/*  40 */     return getGsonOfParams("selectSqlOfIdAndRtime", params, nPageIdx, 
/*  41 */       nPageSize, true);
/*     */   }
/*     */ 
/*     */   public String getMaxBillNo(Object shopId) throws SQLException {
/*  45 */     return getSpTableFieldDayNoShopId("BillNo", shopId);
/*     */   }
/*     */ 
/*     */   public int updateBillPaidOfIds(Long id, Object userName)
/*     */     throws SQLException
/*     */   {
/*  58 */     Object[] strParams = { userName, id };
/*  59 */     return update("updateSaleBillOfId", strParams);
/*     */   }
/*     */ 
/*     */   public GsonHeadOneRow getOneRowOfId(Long id)
/*     */     throws SQLException
/*     */   {
/*  69 */     Map params = new HashMap();
/*  70 */     params.put("id", id);
/*  71 */     return getOneRowOfParams("selectSqlOfId", params);
/*     */   }
/*     */ 
/*     */   public GsonHeadOneRow getBillIntegralOfId(Object id, Object memberId, Integer stId, Long shopId) throws SQLException
/*     */   {
/*  76 */     Map param = new HashMap();
/*  77 */     param.put("memberId", memberId);
/*  78 */     param.put("id", id);
/*  79 */     if (stId.intValue() == 1) {
/*  80 */       int[] status = { 1, 
/*  81 */         2, 3, 
/*  82 */         4, 5, 
/*  83 */         6 };
/*  84 */       param.put("status", status);
/*     */     } else {
/*  86 */       param.put("status", Integer.valueOf(2));
/*     */     }
/*  88 */     ShopMemberDAO shopMemberdao = new ShopMemberDAO();
/*  89 */     Integer levelId = shopMemberdao
/*  90 */       .getLevelIdNormal(memberId, stId, shopId);
/*  91 */     if ((levelId != null) && (levelId.intValue() > 0)) {
/*  92 */       Object[] params = { id, levelId, memberId };
/*  93 */       GsonHeadOneRow g = getOneRowOfParams("selectsqlBillIntegralOfIdLV", 
/*  94 */         params);
/*  95 */       if ((g == null) || (g.getDataLength() <= 0)) {
/*  96 */         g = getOneRowOfParams("selectsqlBillIntegralOfId", param);
/*     */       }
/*  98 */       return g;
/*     */     }
/* 100 */     return getOneRowOfParams("selectsqlBillIntegralOfId", param);
/*     */   }
/*     */ 
/*     */   public GsonHeadOneRow getBillCashCouPonOfId(Object id, Object memberId, Integer stId, Long shopId)
/*     */     throws SQLException
/*     */   {
/* 106 */     Map param = new HashMap();
/* 107 */     param.put("memberId", memberId);
/* 108 */     param.put("id", id);
/* 109 */     if (stId.intValue() == 1) {
/* 110 */       int[] status = { 1, 
/* 111 */         2, 3, 
/* 112 */         4, 5, 
/* 113 */         6 };
/* 114 */       param.put("status", status);
/*     */     } else {
/* 116 */       param.put("status", Integer.valueOf(2));
/*     */     }
/* 118 */     ShopMemberDAO shopMemberdao = new ShopMemberDAO();
/* 119 */     Integer levelId = shopMemberdao
/* 120 */       .getLevelIdNormal(memberId, stId, shopId);
/* 121 */     if ((levelId != null) && (levelId.intValue() > 0)) {
/* 122 */       Object[] params = { id, levelId, memberId };
/* 123 */       GsonHeadOneRow g = getOneRowOfParams(
/* 124 */         "selectsqlBillCashCouPonOfIdLV", params);
/* 125 */       if ((g == null) || (g.getDataLength() <= 0)) {
/* 126 */         g = getOneRowOfParams("selectsqlBillCashCouPonOfId", param);
/*     */       }
/* 128 */       return g;
/*     */     }
/* 130 */     return getOneRowOfParams("selectsqlBillCashCouPonOfId", param);
/*     */   }
/*     */ 
/*     */   public int getStateOfId(Long id)
/*     */     throws SQLException
/*     */   {
/* 142 */     Map param = new HashMap();
/* 143 */     param.put("id", id);
/* 144 */     return queryForInt("getStatusOfId", param, Integer.valueOf(0)).intValue();
/*     */   }
/*     */ 
/*     */   public int updateStatusOfId(Long id, int status) throws SQLException {
/* 148 */     Map param = new HashMap();
/* 149 */     param.put("id", id);
/* 150 */     param.put("status", Integer.valueOf(status));
/* 151 */     return update("updateStatusOfId", param);
/*     */   }
/*     */ 
/*     */   public GsonHeadOneRow getSaleIdOfSaleName(Long id) throws SQLException {
/* 155 */     Object[] params = { id };
/* 156 */     return getOneRowOfParams("selectSqlSaleIdOfName", params);
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.store.salebill.dao.SaleBillDao
 * JD-Core Version:    0.5.3
 */